/**
 * App class of music-engine player application
 *
 * @copyright  hoatle (hoatle.net)
 * @author     hoatle
 * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
 * @version    1.0-alpha
 * @link       http://hoatle.net/en/Project-Music-Engine
 * @since      Class available since Release 1.0-alpha
 */

/**
  * class App
  *
  * Class Constructor
  *
  * @return App
  */
 App = function() {
     this._init();
     return this;
 }

/*
 * App settings
 */
 App.settings = App.prototype.settings = {
     VERSION : "1.0-alpha"
 };

App.settings.prototype = App.settings;

App.settings.window = App.settings.prototype.window = {
     
     CURRENT_STATE: 'normal',
     CURRENT_WIDTH: '780',
     CURRENT_HEIGHT: '585',
     MAX_WIDTH: '1000',
     MAX_HEIGHT: '750',
     MIN_WIDTH: '500',
     MIN_HEIGHT: '375',
     PROGRESS_BAR_ID: 'progress-bar',
     WINDOW_ID: 'music-engine'
 };

 App.settings.window.prototype = App.settings.window;

 App.settings.window.state = {
     NORMAL: 'normal',
     MAXIMUM: 'maximum',
     MINIMUM: 'minimum'
 };
 
 App.settings.prototype.musicEngine = {
     
 }

 /*
  * private _init method
  *
  * Initialize app
  */

 App.prototype._init = function() {
     // App attributes
    this.window = $('#' + App.settings.window.WINDOW_ID);

    this.progressBar = $('#' + App.settings.window.PROGRESS_BAR_ID);


    this.player = null;
    this.searcher = null;

    // Create the GUI
    this._generateGUI();
    // Create all the necessary data and funtionalities
    this._initData();
 }

 /*
  * Generate App GUI
  * @todo Implementation
  */

App.prototype._generateGUI = function() {
    // Set the app-window width and height
    var cssWindow = {
        "width": App.settings.window.MIN_WIDTH + 'px',
        'height': App.settings.window.MIN_HEIGHT + 'px'
    };
    this.window.css(cssWindow);
    var progressBarOptions = {
        value: 0
    };
    this.progressBar.progressbar(progressBarOptions);
}

App.prototype._generateMenuBar = function() {

}

App.prototype._generateToolBar = function() {

}
/*
 * Create all the neccessary data (Song, Searcher, Playlist, Player)
 */
App.prototype._initData = function() {
    this.player = this._initPlayer();
    this.searcher = this._initSearcher();
}

/*
 * Initialize the music-engine player
 *
 * @return Player
 * @todo implementation
 */
App.prototype._initPlayer = function() {
    var player;
    return player;
}

/*
 * Initialize the music-engine searcher
 * @return Searcher
 * @toto implementation
 */
App.prototype._initSearcher = function() {
    var searcher;
    return searcher;
}